define([], function () {

    // 环境判断
    var p='正式';
    var host = "http://121.42.30.191:5005/logger";
    // var host = "http://192.168.2.150:8080";
    var signInHost = "http://115.29.39.62/signin";
    var previewurl = "http://115.29.39.62/logger/dist/index.html#prejournals";

    // var host = "http://10.21.2.29:8080/client-web-logger/";
    // var host = "http://192.168.2.150:8080/client-web-logger";
    if(p==="正式"){
      host = "/logger";
      signInHost = "../signin";
      previewurl = "/logger/dist/index.html#prejournals";
    }



    return {
        init: function (PM) {
            PM.start({
                host: host,//正式环境
                previewurl:previewurl,
                signInHost:signInHost, //签到接口
                loadingColor:"#999",
                ladingErrorIconClass: "qd-loadingerror-icon",
                root: "index/commonpage_my",
                customerComponents: {
                    "dailyrender": "./components/dailyrender",
                    "dailydesigner": "./components/dailydesigner",
                    "autocomplete": "./components/autocomplete",
                    "personselector":"./components/personSelector",
                    "rangetree":"./components/rangetree",
                },
                feature:"<div>新版本更新：<br/>1､ 全新的页面效果、全新的技术框架，用户体验、系统稳定性一级棒<br/>2、增加日志汇总功能，上级汇总下级日志不再困难</div>",
                version:"1.1.2",
                beforeGo: function (config) {
                    var pageInstance = config.pageviewInstance;
                    config.params.token = pageInstance.params.token || "";
                },
                beforeSendAjax: function (config) {
                    var pageviewInstance = config.pageviewInstance;
                    var token = pageviewInstance.params.token || "";
                    var timestamp = (new Date()).valueOf();

                    config.url = config.url + "?timestamp=" + (new Date()).valueOf() + "&token=" + token;


                },
                onAjaxResponse: function (params) {
                },
                routerChange: function (params) {
                    if(params.beforeRouter&&params.beforeRouter.length>0){
                        var fromPageKey = params.beforeRouter[params.beforeRouter.length-1];
                        if(fromPageKey==="designer"){
                            return window.confirm("你确定要离开当前页面吗?")
                        }
                    }
                }
            });

        }
    };
});
